LEX     := flex
LFLAGS  := -l
# -l: Enable compatibility with original lex.

YACC    := bison
YFLAGS  := -vd --debug
# -vd: Enable verbose and produce a header file (*.tab.h).

CC      := gcc
CFLAGS  := -ly -ll
# -ly: Link yacc library.
# -ll: Link lex library.

SOURCES := bjm.c symboltable.c nodes.c
BIN     := bjm

all: ${BIN}

${BIN}:
	${YACC} ${YFLAGS} bjm.y
	${LEX} ${LFLAGS} bjm.l
	${CC} ${CFLAGS} *.tab.c *.yy.c ${SOURCES} -o $@

clean:
	rm *.tab.h
	rm *.tab.c
	rm *.output
	rm *.yy.c
	rm ${BIN}